# Extract URL Information
query_string = context.REQUEST.QUERY_STRING
base_url     = "/".join( traverse_subpath )

# Who is the current user?
user = context.portal_membership.getAuthenticatedMember()

# Create a token
securityService = context.knowledgeengine_securityservice
token = securityService.createAuthToken( user )

# Build the url to the real resource (The current url, minus our script name 'generateAuthToken')
url = context.absolute_url() + "/" + base_url + "?" + query_string + "&authToken=" + token

context.REQUEST.RESPONSE.redirect( url )

